package com.freewater.javabase.demo.resourcebundler.byprogram;

import java.util.Arrays;
import java.util.Locale;
import java.util.ResourceBundle;

/**
 * 编程方式的ResourceBundler
 */
public class ProgramBundlerTest {
    public static void main(String[] args) {
        Locale locale = new Locale("zh", "CN");
        final String baseName = "com.freewater.javabase.demo.resourcebundler.byprogram.DataResource";
        ResourceBundle bundle = ResourceBundle.getBundle(baseName, locale);
        final String key = "user";
        String[] users = bundle.getStringArray(key);
        System.out.println(Arrays.asList(users));
        //
        locale = new Locale("en", "US");
        bundle = ResourceBundle.getBundle(baseName, locale);
        users = bundle.getStringArray(key);
        System.out.println(Arrays.asList(users));
    }
}
